Fix startup json for 9320#206
Merged
q434343 merged 1 commit intodeepmodeling:prcix9320from Dec 25, 2025
Merged
Conversation
…ons, improving state management and initialization logic. Update JSON configuration to reflect type changes for containers and plates.
Reviewer's GuideRefactors PRCXI9300 labware classes (Container, Plate, TipRack, TubeRack) to better handle JSON-deserialized ordering data and state serialization, and updates the 9320 startup test JSON to use the new types and layouts. Sequence diagram for JSON-based initialization of PRCXI9300Plate orderingsequenceDiagram
participant JsonConfig
participant LabwareFactory
participant PRCXI9300Plate
participant Plate
JsonConfig->>LabwareFactory: create_labware(type, definition)
LabwareFactory->>PRCXI9300Plate: __init__(name, size_x, size_y, size_z, category, ordering, ordered_items, model, material_info, kwargs)
alt ordered_items is not None
PRCXI9300Plate->>Plate: __init__(..., ordered_items=ordered_items, category, model, kwargs)
else ordering is not None and values are strings
PRCXI9300Plate->>PRCXI9300Plate: build ordering_param from ordering keys
PRCXI9300Plate->>Plate: __init__(..., ordering=ordering_param, category, model, kwargs)
else ordering is not None and values are objects
PRCXI9300Plate->>Plate: __init__(..., ordered_items=ordering, category, model, kwargs)
else no ordering data
PRCXI9300Plate->>Plate: __init__(..., category, model, kwargs)
end
Updated class diagram for PRCXI9300 labware typesclassDiagram
class Deck
class Plate
class TipRack
class TubeRack
class PRCXI9300Deck {
+slots: list
+__init__(name: str, size_x: float, size_y: float, size_z: float, kwargs)
}
PRCXI9300Deck --|> Deck
class PRCXI9300Container {
-_unilabos_state: Dict~str, Any~
+__init__(name: str, size_x: float, size_y: float, size_z: float, category: str, ordering: OrderedDict~str, Any~, model: str, kwargs)
+load_state(state: Dict~str, Any~) void
+serialize_state() Dict~str, Dict~str, Any~~
}
PRCXI9300Container --|> Plate
class PRCXI9300Plate {
-_unilabos_state: Dict~str, Any~
+__init__(name: str, size_x: float, size_y: float, size_z: float, category: str, ordering: OrderedDict~str, Any~, ordered_items: OrderedDict~str, Any~, model: str, material_info: Dict~str, Any~, kwargs)
+load_state(state: Dict~str, Any~) void
+serialize_state() Dict~str, Dict~str, Any~~
}
PRCXI9300Plate --|> Plate
class PRCXI9300TipRack {
-_unilabos_state: Dict~str, Any~
+__init__(name: str, size_x: float, size_y: float, size_z: float, category: str, ordering: OrderedDict~str, Any~, ordered_items: OrderedDict~str, Any~, model: str, material_info: Dict~str, Any~, kwargs)
+load_state(state: Dict~str, Any~) void
+serialize_state() Dict~str, Dict~str, Any~~
}
PRCXI9300TipRack --|> TipRack
class PRCXI9300TubeRack {
-_unilabos_state: Dict~str, Any~
+__init__(name: str, size_x: float, size_y: float, size_z: float, category: str, items: Dict~str, Any~, ordered_items: OrderedDict~str, Any~, ordering: OrderedDict~str, Any~, model: str, material_info: Dict~str, Any~, kwargs)
+load_state(state: Dict~str, Any~) void
+serialize_state() Dict~str, Dict~str, Any~~
}
PRCXI9300TubeRack --|> TubeRack
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The ordering/ordered_items normalization logic in PRCXI9300Plate, PRCXI9300TipRack, and unilabosTubeRack is nearly identical; consider extracting a small helper to reduce duplication and keep future changes to this behavior consistent across labware types.
- In PRCXI9300Container.serialize_state you unconditionally
updatethe Plate state with_unilabos_state; if both contain the same keys this will silently overwrite Plate-managed data, so it may be safer to either namespace custom keys or explicitly resolve conflicts. - The inline comment
# 其他顶层属性也进行类型检查appears after thereturn datain PRCXI9300Plate.serialize_state, making it unreachable and slightly misleading—moving this comment above the return or adjusting the logic would improve readability.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The ordering/ordered_items normalization logic in PRCXI9300Plate, PRCXI9300TipRack, and unilabosTubeRack is nearly identical; consider extracting a small helper to reduce duplication and keep future changes to this behavior consistent across labware types.
- In PRCXI9300Container.serialize_state you unconditionally `update` the Plate state with `_unilabos_state`; if both contain the same keys this will silently overwrite Plate-managed data, so it may be safer to either namespace custom keys or explicitly resolve conflicts.
- The inline comment `# 其他顶层属性也进行类型检查` appears after the `return data` in PRCXI9300Plate.serialize_state, making it unreachable and slightly misleading—moving this comment above the return or adjusting the logic would improve readability.
## Individual Comments
### Comment 1
<location> `unilabos/devices/liquid_handling/prcxi/prcxi.py:189` </location>
<code_context>
data.update(safe_state)
- return data
-
+ return data # 其他顶层属性也进行类型检查
class PRCXI9300TipRack(TipRack):
""" 专用吸头盒类 """
</code_context>
<issue_to_address>
**nitpick:** Inline comment after `return` is misleading given the current implementation.
The `# 其他顶层属性也进行类型检查` comment implies more top-level type checks than are actually performed (only `_unilabos_state` is filtered before return). Consider either removing/rewording this comment to match the behavior, or adding the missing checks if they’re required.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| data.update(safe_state) | ||
| return data | ||
|
|
||
| return data # 其他顶层属性也进行类型检查 |
There was a problem hiding this comment.
nitpick: Inline comment after return is misleading given the current implementation.
The # 其他顶层属性也进行类型检查 comment implies more top-level type checks than are actually performed (only _unilabos_state is filtered before return). Consider either removing/rewording this comment to match the behavior, or adding the missing checks if they’re required.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enhance PRCXI9300 classes with new Container and TipRack implementations, improving state management and initialization logic. Update JSON configuration to reflect type changes for containers and plates.
Summary by Sourcery
Refine PRCXI 9300 labware handling to better support JSON-driven initialization and state persistence for containers, plates, tip racks, and tube racks.
New Features:
Enhancements:
Tests: